<!DOCTYPE html>
<html lang="en">
<!--京东商城后台管理系统-->
<head>
    <meta charset="UTF-8">
    <title>商品品牌查询</title>
    <link rel="stylesheet" href="js/bootstrap.min.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.validate.js"></script>
    <script src="js/jquery.validate.regex.js"></script>
    <script>
        $(function () {
            $("#textChange").validate({
                rules:{
                    sortname:{
                        required:true
                    }
                },
                messages:{
                    sortname:{
                        required:"该字段必填！"
                    }
                },
                submitHandler:function () {
                    $.ajax({
                        url:"http://localhost:8080/addBrand",
                        type:"post",
                        data:{
                            "brandName":$("input[id='brandname']").val()
                        },
                        dataType:"json",
                        success:function (data) {
                            if(data===1){
                                alert("商品品牌添加成功！");
                            }else {
                                alert("该品牌已经存在！");
                            }
                        }
                    });
                },
                errorPlacement: function(error, element){
                    error.appendTo("#warn");
                }

            });


        });
    </script>

</head>
<body >
<div class="row">
    <div class="col-md-2">
        <img src="images/logo-201305-b.png" >
    </div>
    <div class="col-md-10">
        <h2 class="text-primary text-center">京东商城后台管理系统</h2>
    </div>
</div>

<div class="row"  style="background-color:#F5F5F5;">
    <!--侧边菜单-->
    <div class="col-md-2 text-center"  >
        <a href="#" class="list-group-item active">商品种类管理</a>
        <a href="sort1.html" class="list-group-item">添加商品种类</a>
        <a href="sort2.html" class="list-group-item">管理商品种类</a>
        <a href="sort3.html" class="list-group-item">商品品牌管理</a>
        <a href="sort4.html" class="list-group-item color">商品品牌添加</a>
        <a href="#" class="list-group-item active">商品管理</a>
        <a href="product_add.html" class="list-group-item">商品添加</a>
        <a href="product_delete.html" class="list-group-item">商品删除</a>
        <a href="product_change.html" class="list-group-item">商品修改</a>
        <a href="product_select.html" class="list-group-item  color">商品查询</a>
        <a href="product_addImg.html" class="list-group-item">商品图片添加</a>
        <a href="#" class="list-group-item active">订单管理</a>
        <a href="orders_select.html" class="list-group-item">查看订单</a>
        <a href="orders_change.html" class="list-group-item">修改订单</a>
        <a href="#" class="list-group-item active">用户管理</a>
    </div>
    <div class="col-md-10">
        <!--面包屑导航-->
        <ol class="breadcrumb">
            <li><a href="#">首页</a></li>
            <li><a href="#">商品种类管理</a></li>
            <li><a href="#">商品品牌添加</a></li>
            <!--<li class="active">十一月</li>-->
        </ol>
        <form  id="textChange"  style="margin-top: 130px;margin-right: 15%;margin-left: 15%">
            <div class="row">
                <div class="col-lg-10">
                    <div class="input-group">
                        <span class="input-group-addon">商 品 品 牌 名</span>
                        <input type="text" class="form-control" placeholder="请输入种类名" id="brandname" name="brandname">
                    </div>
                </div>
                <div class="col-lg-2">
                    <input type="submit" class="btn btn-primary btn-sm" value=" 添 加 ">
                </div>
            </div>
            <p id="warn"></p>
        </form>
    </div>
</div>
</body>
</html>